package com.globallogic.jira.generators;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import com.atlassian.configurable.ValuesGenerator;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.config.ConstantsManager;
import com.atlassian.jira.issue.issuetype.IssueType;

/**
 * @author yegor.chumakov
 */
public class IssueValuesGenerator implements ValuesGenerator {
    public Map<String, String> getValues(
	    @SuppressWarnings("rawtypes") Map userParams) {
	Map<String, String> issuesMap = new HashMap<String, String>();

	ConstantsManager constantsManager = ComponentManager.getInstance()
		.getConstantsManager();
	Collection<IssueType> issueTypes = constantsManager
		.getAllIssueTypeObjects();

	for (IssueType issueType : issueTypes) {
	    issuesMap.put(issueType.getName().replace(" ", "+"),
		    issueType.getName());
	}
	return issuesMap;
    }
}